<?= $this->partial('groups/menu.phtml'); ?>

<br/>

<div class="content-full">

<h1>Group list</h1>

<table width='20%' class='shaded'>
    <tr>
        <td><a href="<?= $this->route("groups", "create"); ?>">Create a group</a></td>
    </tr>
</table>

<br/>

<table class='shaded'>
<tr>
	<th>Name</th>
	<th>Members</th>
	<th>&nbsp;</th>
	<th>&nbsp;</th>
	<th>&nbsp;</th>
</tr>

<?php foreach($this->groups as $group) : ?>
<tr class="<?= $this->alternator(array("odd","even")); ?>">
	<td>	
		<b>
		<?= $this->escape($group->name); ?>
		</b>
	</td>
	
	<td>	
		<? if (!$group->def): ?> 
			<b><?= count($this->members[$group->id]); ?></b>
		<? else: ?>
			<em>Everyone</em>
		<? endif; ?>
	</td>
	<td>
		<? if (!$group->def): ?>
		<a href="<?= $this->url(array('controller'=>'groups', 'action'=>'members', 'group'=>$group->id)) ?>">
			Members
		</a>
		<? else: ?>
			...
		<? endif; ?>
	</td>
	<td>
		<a href="<?= $this->url(array('controller'=>'groups', 'action'=>'rights', 'group'=>$group->id)) ?>">
		Grants
		</a>
	</td>
	<td>
		<a href="<?= $this->url(array('controller'=>'groups', 'action'=>'delete', 'group'=>$group->id)) ?>">
		Delete
		</a>
	</td>
</tr>
<?php endforeach; ?>

</table>

</div>